package com.at.abc.r420_ak;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;

public class b {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        solve();
        out.flush();
        out.close();
        br.close();
    }

    static void solve() throws IOException {
        String[] in = br.readLine().split(" ");
        int n = Integer.parseInt(in[0]);
        int m = Integer.parseInt(in[1]);
        char[][] s = new char[n][m];
        for (int i = 0; i < n; i++) {
            char[] c = br.readLine().toCharArray();
            s[i] = c;
        }
        int[] ans = new int[n];
        for (int i = 0; i < m; i++) {
            int x = 0, y = 0;
            for (int j = 0; j < n; j++) {
                if (s[j][i] == '0') x++;
                else if (s[j][i] == '1') y++;
            }
            /*if (x == 0 || y == 0) {
                for (int j = 0; j < n; j++) {
                    ans[j]++;
                }
            }*/
            if (x < y) {
                for (int j = 0; j < n; j++) {
                    if (s[j][i] == '0') ans[j]++;
                }
            } else {
                for (int j = 0; j < n; j++) {
                    if (s[j][i] == '1') ans[j]++;
                }
            }
        }
        int max = Arrays.stream(ans).max().orElseThrow();
        for (int i = 0; i < n; i++) {
            if (ans[i] == max) out.print(i + 1 + " ");
        }
        out.println();
    }
}
